﻿
using Medicine.Service;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Medicine.View
{
    public partial class AddRecord : Form
    {
        private RecordService rs = new RecordService();
        public AddRecord()
        {
            InitializeComponent();
            this.textBox3.Text= DateTime.Now.ToString(); 
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Medicine.Entity.Record r = new Medicine.Entity.Record();
           
            r.Time = this.textBox3.Text.Trim();
            r.Adress = this.textBox4.Text.Trim();
            r.Remark = this.richTextBox1.Text.Trim();
            if (this.textBox1.Text.Trim() == "" || this.textBox2.Text.Trim() == "" || r.Time == "" || r.Adress == "" || r.Remark == "")
                MessageBox.Show("检查是否没有输入完整");
            else
            {
                r.User_id = int.Parse(this.textBox2.Text.Trim());
                r.Medicine_id = int.Parse(this.textBox1.Text.Trim());
                rs.buyMedicine(r);
                this.Close();
            }
            
        }
    }
}
